package Text1;

import java.util.*;

public class Main {
    //    对于每一名学生，请你计算他至少还要再刷多少道题，
//    才能使得全班刷题比他多的学生数不超过刷题比他少的学生数。
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] a = new int[n];
        int[] b = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = in.nextInt();
            b[i] = a[i];
        }
        Arrays.sort(b);
        int mid = b[n / 2];
        int l = 0, r = 0;
        for (int i = 0; i < n; i++) {
            if (a[i] > mid) {
                r++;
            } else if (a[i] < mid) {
                l++;
            }
        }
        for (int i = 0; i < n; i++) {
           if(l==r){
               if(a[i]>=mid){
                   System.out.print(0+" ");
               }else{
                   System.out.print(mid-a[i]+1+" ");
               }
           } else if (l>r) {
               if(a[i]>=mid){
                   System.out.print(0+" ");
               }else{
                   System.out.print(mid-a[i]+" ");
               }
           }else{
               if(a[i]>mid){
                   System.out.print(0+" ");
               }else {
                   System.out.print(mid-a[i]+1+" ");
               }
           }
        }
    }
}
